package autogo

import (
	"log"
	"time"

	w32 "github.com/gonutz/w32/v2"
)

func PrtSc(isCurrent bool) {
	//截屏键，参数是否截取当前窗口
	if isCurrent {
		Key2Click(w32.VK_LMENU, w32.VK_SNAPSHOT)
	} else {
		KeyClick(w32.VK_SNAPSHOT)
	}

}

// todo 查找指定的图像所在的屏幕位置
func MatchImg() (Dx int, Dy int) {
	//停5秒最小化当前窗口
	time.Sleep(5000 * time.Millisecond)
	for i := 0; i < 500; i++ {
		x, y, ok := w32.GetCursorPos()
		log.Println("GetCursorPos", ok, "x:", x, "y:", y)

		MouseMove(1266, 200)

		KeyClick(w32.VK_NEXT)

		KeyCopy()

		KeyPaste()

		MouseMove(793, 812)
		MouseClick()

	}
	return
}

// 鼠标移动到指定图片位置
func MouseMoveImg() {
	MouseMove(MatchImg())
}
